<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>北京联合大学</title>
</head>
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://at.alicdn.com/t/font_835526_uzbxo9d25is.css">
<link rel="stylesheet" href="../../css/Initialization.css">
<link rel="stylesheet" href="../../css/commen.css">
<link rel="stylesheet" href="../../css/woker111.css">
<link rel="stylesheet" href="../../css/unit.css">

<body>
<div id="content">
    <div class="initer">
        <!-- 具体内容 -->
        <div class="bread">
            <div class="plain">
                分组信息
            </div>
            <div class="plain">
                <i class="iconfont icon-right"></i>
            </div>
            <div class="plain current">
                学生分组审核
            </div>
            <div class="center-button">
                <span>分组信息导出</span>
            </div>
        </div>
        <div class="list task mb20">
            <ul>
                <li class="toexamine" th:each="item : ${pageResult.list}">
                        <span class="tite">
                            <i class="icon-dian iconfont"></i>
                            <span th:text="${item.groupname}" id="showtitle">打造一个世界500强</span>
                        </span>
                    <span class="person">
                            <span th:text="${item.foundername}">(10人)</span>
                            <span th:text="${item.groupintro}">李国庆、张三、李素、王五</span>
                        </span>
                    <span class="tongguo" th:if="${item.state == 1}">未通过</span>
                    <span class="tongguo" th:if="${item.state == 2}">审核通过</span>
                    <div class="quanxian">
                        <span class="min-button r20" th:if="${item.state == 1}" th:onclick="'javascript:examineGroup(\''+${item.id}+'\',0,this)'">同意</span>
                        <span class="min-button" th:if="${item.state == 1}" th:onclick="'javascript:examineGroup(\''+${item.id}+'\',1,this)'">拒绝</span>
                    </div>
                </li>

            </ul>
        </div>
        <!-- 分页 -->
        <div class="pages" th:utext="${pageResult.getPageHtml()}"></div>
        <!-- 确认删除弹窗 -->
        <div class="mask none">
            <div class="sureteam">
                <div class="title">确认小组审核通过</div>
                <div class="teamcenter">
                    <div class="teamdesc_tip" id="resultmessage">确定</div>
                    <div class="surebtns">
                        <input type="hidden" id="groupid" name="groupid"/>
                        <input type="hidden" id="state" name="state"/>
                        <div class="center-button" id="yesjoin">确认加入</div>
                        <div class="center-button" id="nojoin">暂不审核</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../../js/jquery-3.4.1.min.js"></script>
<script src="../../js/commen.js"></script>
<script th:inline="javascript">
    function examineGroup(groupid,state,obj) {
        var showtitle = $(obj).parent().parent().find("#showtitle").html();
        if(state == 0){
            $("#title").html("审核通过");
            $("#resultmessage").html("是否确认“"+showtitle+"”小组审核通过");
            $("#yesjoin").html("同意");
        }else{
            $("#title").html("审核拒绝");
            $("#resultmessage").html("是否确认拒绝“"+showtitle+"”小组审核通过");
            $("#yesjoin").html("拒绝");
        }
        $("#groupid").val(groupid);
        $("#state").val(state);
        $('.mask').removeClass('none');
        $("#yesjoin").unbind();
        $("#yesjoin").click(function () {
            goexamine(groupid,state);
        });
    }

    function goexamine(groupid,state){
        $.ajax({
            type : "POST",
            url : "examineGroup",
            data : {groupid: groupid,state:state},
            dataType : "json",
            success : function(json) {
                change(json)
            },
            error:function(msg){
                alert("程序出错，请联系管理员");
            }
        });
    }

    function change(json){
        $("#resultmessage").html(json.result);
        $("#yesjoin").hide();
        $("#nojoin").html("确定");
        if(json.state == success){
            var mid = [[${mid}]];
            var sid = [[${sid}]];
            var gradeid = [[${gradeid}]];
            $("#nojoin").click(function () {
                location.reload();
            });
        }else{
            $("#nojoin").click(function () {
                $('.mask').addClass('none');
                location.reload();
            });
        }
    }

    $(function () {
        $("#nojoin").click(function () {
            $('.mask').addClass('none');
        });
    })
</script>
</body>
</html>
